/**
 * @author guocailee
 */
import map from '../config/dictionary'

let dictionary = (value, type) => {
  if (!map[type]) {
    return null
  }
  var results = null
  for (var i = map[type].length - 1; i >= 0; i--) {
    if (map[type][i].value === value) {
      results = map[type][i].text
      break
    }
  }
  return results
}
let plugin = (Vue) => {
  if (plugin.installed) {
    return
  }
  Vue.prototype.$dictionary = dictionary
  Vue.filter('dictionary', dictionary)
}
export default plugin
